<meta charset="UTF-8">
<?php
require 'h.php';
$db->query('set names utf8');
$username=$_POST['username'];
$message=$_POST['message'];
$imgurl=$_POST['imgurl'];
$sex=$_POST['sex'];
$sqlins="insert into t_message (username,message,imgurl,sex) values ('$username','$message','$imgurl','$sex');";
if($db->query($sqlins)){
    echo "<script language='javascript' type='text/javascript'>";
    echo "alert('留言成功！');";
    echo "window.location.href='index.php';";
    echo "</script>";
}else{
    echo '留言不成功！';
}
